# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        黄周云  
# Name:         test07
# Description:  例12.13
# Author:       ASUS
# Date:         2019/3/30
#-------------------------------------------------------------------------------


import datetime
#定义日期
d1 = datetime.datetime(2017,4,12)
d2 = datetime.datetime(2018,12,25)
print((d2-d1).days)

d3 = datetime.datetime(2017,4,12,10,10,10)
d4 = datetime.datetime(2018,12,25,10,11,44)
print(d2-d1)
print((d2-d1).seconds)

#获取当前时间
d5 = datetime.datetime.now()
#将当前时间往后延10小时
d6 = d5+datetime.timedelta(hours=10)
import time
d6 = time.localtime(d6.timestamp())
print(time.strftime("%Y-%m-%d %H:%M:%S",d6))

